package com.sloera.nowcoder;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Queue;
import java.util.Scanner;

/**
 * class com.sloera.nowcoder
 * user sloera
 * date 2022/2/22
 */
public class HJ26 {
    public static void main(String[] args) {
        // System.out.println('A');
        // System.out.println('A'-'a');
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String a = in.nextLine();
            sort(a);
            System.out.print("\n");
        }
    }

    /**
     * 排序逻辑
     *
     * @return void
     * @date 2022/2/22
     */
    private static void sort(String s) {
        final char[] chars = s.toCharArray();
        // final char[] alphabet = new char[s.length()];
        final char[] special = new char[s.length()];
        final ArrayList<Queue<Character>> alphabet = new ArrayList<>(26);
        for (int i = 0; i < 26; i++) {
            Queue<Character> characters = new ArrayDeque<>();
            alphabet.add(characters);
        }
        // 区分存放字母或非字母
        for (int i = 0; i < chars.length; i++) {
            final int number = getNumber(chars[i]);
            if (number != -1) {
                alphabet.get(number).add(chars[i]);
            } else {
                special[i] = chars[i];
            }
        }
        for (int i = 0; i < special.length; i++) {
            if (special[i] != 0) {
                System.out.print(special[i]);
                continue;
            }
            for (int j = 0; j < alphabet.size(); j++) {
                final Character poll = alphabet.get(j).poll();
                if (poll != null) {
                    System.out.print(poll);
                    break;
                }
            }
        }
    }

    /**
     * 返回大小写无关的大小
     *
     * @return int
     * @date 2022/2/22
     */
    private static int getNumber(char aChar) {
        if (aChar >= 'A' && aChar <= 'Z') {
            return aChar - 'A';
        }
        if (aChar >= 'a' && aChar <= 'z') {
            return aChar - 'a';
        }
        return -1;
    }
}
